package com.spsoft.dmzeinvoice.common.utils;

import org.apache.commons.io.FileUtils;
import org.springframework.util.ResourceUtils;

import java.io.File;
import java.io.IOException;

/**
 * 获取乐企模拟数据工具类
 */
public class LeqiMockUtil {

    //=====发票基础能力模拟数据=====

    /**
     * 获取纳税人企业基本信息Mock数据
     */
    public static String getEnterpriseStr() {
        String filePath = "base/enterprise.json";
        return getMockJson(filePath);
    }

    /**
     * 查询纳税人风险信息Mock数据
     */
    public static String getEnterpriseRiskStr() {
        String filePath = "base/enterpriseRisk.json";
        return getMockJson(filePath);
    }

    /**
     * 查询税收分类编码信息Mock数据
     */
    public static String getClassifyCodeStr() {
        String filePath = "base/classifyCodeQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 查询可用税率信息Mock数据
     */
    public static String getAvalibleTaxRateStr() {
        String filePath = "base/taxRatesQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 查询授信额度信息Mock数据
     */
    public static String getCreditLimitStr() {
        String filePath = "base/creditLimitInfoQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 查询授信额度有效期Mock数据
     */
    public static String getCreditPeriodStr() {
        String filePath = "base/creditLimitPeriod.json";
        return getMockJson(filePath);
    }

    /**
     * 查询下载/退回授信额度Mock数据
     */
    public static String getApplyCreditStr() {
        String filePath = "base/creditLimitApply.json";
        return getMockJson(filePath);
    }

    /**
     * 查询预赋码信息Mock数据
     */
    public static String getAssignedCodeStr() {
        String filePath = "base/preCodeQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 数电票上传Mock数据
     */
    public static String getUploadInvoiceStr() {
        String filePath = "base/invoiceUpload.json";
        return getMockJson(filePath);
    }

    /**
     * 查询数电票上传结果Mock数据
     */
    public static String getUploadInvoiceStatusStr() {
        String filePath = "base/invoiceUploadQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 通用成功返回Mock数据
     */
    public static String getBaseResponseStr() {
        String filePath = "base/baseResponse.json";
        return getMockJson(filePath);
    }

    /**
     * 查询发票汇总确认信息Mock数据
     */
    public static String getUploadInvoiceSummaryStr() {
        String filePath = "base/invoiceSummaryQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 数电红字确认单申请Mock数据
     */
    public static String getApplyRedConfirmStr() {
        String filePath = "base/redConfirmApplyResult.json";
        return getMockJson(filePath);
    }

    /**
     * 数电红字确认单确认Mock数据
     */
    public static String getConfirmRedConfirmStr() {
        String filePath = "base/redConfirmConfirmResult.json";
        return getMockJson(filePath);
    }

    /**
     * 查询数电红字确认单列表信息Mock数据
     */
    public static String getRedConfirmListStr() {
        String filePath = "base/redConfirmListQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 查询数电红字确认单明细信息Mock数据
     */
    public static String getRedConfirmDetailStr() {
        String filePath = "base/redConfirmDetailQuery.json";
        return getMockJson(filePath);
    }

    //=====发票归集能力模拟数据=====

    /**
     * 批量发票下载申请Mock数据
     */
    public static String getBatchLoadInvoiceStr() {
        String filePath = "collect/batchLoadInvoice.json";
        return getMockJson(filePath);
    }

    /**
     * 批量发票下载申请反馈Mock数据
     */
    public static String getBatchLoadInvoiceFeedbackStr() {
        String filePath = "collect/batchLoadInvoiceFeedback.json";
        return getMockJson(filePath);
    }

    /**
     * 查询增量下载发票信息Mock数据
     */
    public static String getIncLoadInvoiceQueryStr() {
        String filePath = "collect/incLoadInvoiceQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 发票风险信息查询Mock数据
     */
    public static String getInvoiceRiskQueryStr() {
        String filePath = "collect/invoiceRiskQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 发票用途状态信息查询Mock数据
     */
    public static String getInvoiceUsedStatusQueryStr() {
        String filePath = "collect/invoiceUsedStatusQuery.json";
        return getMockJson(filePath);
    }

    /**
     * 查询发票汇总确认信息Mock数据
     */
    public static String getDifferentialTaxationStr() {
        String filePath = "base/differentialTaxation.json";
        return getMockJson(filePath);
    }

    /**
     * 查询发票汇总确认信息Mock数据
     */
    public static String getHouseInfoStr() {
        String filePath = "base/houseInfo.json";
        return getMockJson(filePath);
    }

    public static String getMockJson(String fileName) {
        try {
            File jsonFile = ResourceUtils.getFile("classpath:mockjson/" + fileName);
            return FileUtils.readFileToString(jsonFile);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) {
        String s = getMockJson("base/enterprise.json");
        System.out.println(s);
    }
}

